// 车位管理接口
import request from '@/utils/request'
// import { getUser, getToken } from '@/utils/auth'
import qs from 'qs'

export function getPlaceList(data, stationId) {
  if (!stationId) stationId = data.stationId || '0'
  // data.stationId = stationId
  return request({
    url: '/place/page/by/station/' + stationId,
    method: 'post',
    data
  })
}

export function getPlaceListSection(data, sectionId) {
  if (!sectionId) sectionId = data.sectionId || '0'
  // data.sectionId = sectionId
  return request({
    url: '/place/page/by/section/' + sectionId,
    method: 'post',
    data
  })
}

// 添加车位
export function addPlace(data) {
  return request({
    url: '/place/add',
    method: 'post',
    data
  })
}

// 修改车位
export function putPlace(data) {
  return request({
    url: '/place/edit',
    method: 'post',
    data
  })
}

// 删除车位
export function delPlace(data) {
  return request({
    url: '/place/del/' + data.placeId,
    method: 'delete',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    data: qs.stringify(data)
  })
}
